home *** CD-ROM | disk | FTP | other *** search
- Path: holly.ACNS.ColoState.EDU!not-for-mail
- From: corbyh@holly.ACNS.ColoState.EDU (Corby S. Hudnall)
- Newsgroups: comp.lang.c++
- Subject: Re: 'delete' dos not work !!!! (for me...)
- Date: 26 Mar 1996 19:35:10 -0700
- Organization: Colorado State University, Fort Collins, CO 80523
- Message-ID: <4ja9gu$4arm@holly.ACNS.ColoState.EDU>
- References: <ROLLET.96Mar18215549@oriole.DMI.USherb.CA> <4iq7ee$enb@pegasus.odyssee.net>
- NNTP-Posting-Host: holly.acns.colostate.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- : If you alocate using [], use [] to free.....
-
- : int *i = new int [256];
-
- : free [] i;
- ^^^^
-
- not quite right. if you new'd memory, you must use delete. if you
- malloc'd memory, you must use free. You can not "free" new'd space or
- "delete" malloc'd space. Use:
-
- delete [] i;
-
- in your code instead.
-
- // ------------ BEGIN SIGNATURE ---------------
- #include <iostream.h>
- void main(void)
- {
- cout << "\aName:\tCorby S. Hudnall\n"
- << "School:\tColorado State University\n"
- << "\tDepartement of Computer Science\n"
- << "EMail:\thudnall@CS.ColoState.EDU\n"
- << "URL:\thttp://WWW.CS.ColoState.EDU/~hudnall\n";
- }
- // ------------ END SIGNATURE -----------------
-
-
-
-